import { App } from 'vue';

export default {
  install: (app: App) => {
    // xx/index.ts
    const modules = import.meta.globEager('./**/index.ts');
    for (const key in modules) {
      let name = key.replace(/(\.\/|\.tsx|\.vue|\.ts)/g, '');
      if (name.includes('/')) {
        name = name.split('/')[0];
      }
      app.directive(name, modules[key].default);
    }
  }
};